package com.ithinkstudio.jeez.generator.db;

import com.ithinkstudio.jeez.generator.config.GenerateConfig;
import com.ithinkstudio.jeez.utils.SpringUtils;

/**
 * 数据查询工厂
 * @author felix
 */
public class DbQueryFactory {

    public static IDbQuery getDbQuery() {
        GenerateConfig config = SpringUtils.getBean(GenerateConfig.class);
        IDbQuery dbQuery = null;
        switch (config.getDb().toLowerCase()) {
            case "mysql":
                dbQuery = SpringUtils.getBean("mysqlQuery");
                break;
            case "oracle":
                dbQuery = SpringUtils.getBean("oracleQuery");
                break;
            case "postgresql":
                dbQuery = SpringUtils.getBean("postgresqlQuery");
                break;
            default:

        }
        return dbQuery;
    }

}
